<template>
  <el-container class="first_con">
    <el-header>
      <div>
        <img src="../../assets/logo.png" style="width: 45px; height: 45px" />
        <span>博客管理系统</span>
      </div>
      <div>
        <el-dropdown trigger="click" @command="handleCommand">
          <span class="el-dropdown-link">
            {{ adminName
            }}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item icon="el-icon-circle-check" command="loginout"
              >退出登录</el-dropdown-item
            >
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-header>
<!-- 左侧边栏 -->
      <el-container>
            <sidebar></sidebar>
            <el-main>
                    <tag></tag>
                    <router-view></router-view>
             </el-main>
            </el-container>           
        </el-container>
</template>
<script>

import Tag from './Tag.vue';

import bus from './bus.js'
import Sidebar from './Sidebar.vue';
export default {
  components:{
    Tag,
    // Tags,
    Sidebar
  },
    data(){
     
         return{
            isCollapse:false,
                name:window.localStorage.getItem('name'),
                adminName:localStorage.getItem('adminName'),
                adminLastLoginAt:localStorage.getItem('adminLastLoginAt'),              
                tagList:[],
                collapse:true,
        }
    },
    
        methods:{
            handleCommand(command){
                if(command == 'loginout'){
                  localStorage.clear();
                  this.$router.push('/')
                }
            }
        }
};
</script>

<style scoped>
.el-dropdown-link{
  color: #fff;
  
}

.first_con {
  height: 100%;
}
.el-header {
  background: rgb(55, 62, 65);
  display: flex;
  justify-content: space-between;
  line-height: 60px;
  color: #fff;
  font-size: 18px;
}
.el-header img {
  vertical-align: middle;
}
/* .aside_position{
  text-align: center;
} */
.el-menu{
  overflow: hidden;
  border-right:0;
  
}
.el-aside {
  background: rgb(51, 55, 68);
}
.el-main {
  background: rgb(234, 237, 241);
  padding: 0;
  margin: 0;
}
.el-avatar{
  vertical-align: middle;
}
.middle{
  margin-left: 20px;
}
.el-button{
  border:none;
}

</style>